package com.eaoa.uc.permission.action;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.eaoa.base.EABaseAction;
import com.eaoa.uc.permission.bo.ModuleDeleteBO;
import com.stony.core.util.CoreUtils;

public class ModuleDeleteAction extends EABaseAction{

	protected ActionForward doWork(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		String modulenostr  =  request.getParameter("moduleno"); 
		
		Long moduleno =  CoreUtils.parseLong(modulenostr);
		
		String result = "success";
		
		try {
			ModuleDeleteBO bo = new ModuleDeleteBO(moduleno);
			bo.execute();
		} catch (RuntimeException e) {
			result = "failure";
		}finally{
			PrintWriter out= response.getWriter();
			out.write(result);
			out.flush();
			out.close();
		}

		return null;
	}


}
